package Java7_Concurrency_Cookbook.concurrent_collection_framework.thread_local_random;

import java.util.concurrent.ThreadLocalRandom;

/**
 * @author lixiangke
 * @date 2017/11/24
 */
public class TaskLocalRandom implements Runnable {

    public TaskLocalRandom() {
        ThreadLocalRandom.current();
    }

    @Override
    public void run() {
        String tName = Thread.currentThread().getName();
        for (int i = 0; i < 10; i++) {
            System.out.printf("%s: %d\n", tName, ThreadLocalRandom.current().nextInt(10));
        }
    }
}
